package my.com.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *  重定向
 *      服务端指导，客户端行为
 *       存在两次请求
 *       地址栏会发生改变
 *       requset对象不共享数据
 */
@WebServlet("/s04")
public class Servlet04 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("Servlet04...");

        //接受参数
        String uname = req.getParameter("uname");
        System.out.println("Servlet04:"+uname);
        //重定向跳转到s05
        resp.sendRedirect("s05");
    }
}
